//
// Description: 1646. 获取生成数组中的最大值
// Created by Loading on 2021/8/23.
//

#include <bits/stdc++.h>

using namespace std;

int getMaximumGenerated(int n) {
    if (n == 0) {
        return 0;
    }
    vector<int> nums(n + 1);
    nums[1] = 1;
    for (int i = 2; i <= n; ++i) {
        nums[i] = nums[i / 2] + i % 2 * nums[i / 2 + 1];
    }

    return *max_element(nums.begin(), nums.end());
}

int main() {
    int n = 7;
    int res = getMaximumGenerated(n);
    cout << res << endl;
    return 0;
}